package com.example.myhelloworld.client;
/*
Custom hashing function.

*/

public class Hasher
{
   public static String hash(String s)
   {	   
	   String res = "";
	   if (s.length()==0) s = "empty";
	   if (s.length()>0) s += ""+s.charAt(0);
	   int hcsum = 0;
	   for (int i = 0; i<s.length(); i++) {
	     hcsum += s.charAt(i)/2;
	   }
	   for (int i = 1; i<s.length(); i++) {	     
	     res += hcsum*s.charAt(i)/102 - i*s.charAt(i-(s.length()==1?0:1))/2;
	   }	      
	   		
	   return res;
   }


   public static void main(String []args)
   {
      // Main method for testing
      String sTest= args[0];
      System.out.println(sTest);
      System.out.println(hash(sTest));
   }
}
